# Authors : Katrina Payne
# Project : PokeZX
# License : Documentation/LICENSE.txt
# File    : core/Library/SocketZX.py
# Purpose :
# All for either a peer2peer socket setup, or a server setup. Protocols
# Will be defined elsewhere (possibly deriving an object based on this 
# setup)

import __main__ as main

import socket
import threading
import SocketServer

class HandlerZX(SocketServer.BaseRequestHandler):
    pass

class ServerZX(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
    pass

def connect(host,port):
    conn = socket.socket(socekt.AF_INET, socket.SOCK_STREAM)
    conn.connect((host,port))
    return conn

def server_start(host,port,handler):
    server = ServerZX((host,port),handler)
    server_thread = threading.Thread(target=server.serve_forever)
    server_thread.setDaemon(True)
    server_thread.start()
    return server_thread
